package com.TanNgee;

import com.TanNgee.annotation.RpcReference;
import org.springframework.stereotype.Component;

/**
 * @author 陈毅
 * @create 2022/3/23 15:49
 */


@Component
public class HelloController {

    //    @RpcReference(version = "version1", group = "test1")
    @RpcReference(version = "version2", group = "test2")
    private HelloService helloService;

    public void test() throws InterruptedException {
/**
 * hello： 方法执行结果
 */
        String hello = this.helloService.hello(new Hello("1001", "测试，测试我的RPC"));

        //如需使用 assert 断言，需要在 VM options 添加参数：-ea
        assert "Hello description is 222".equals(hello);
        Thread.sleep(12000);
        for (int i = 0; i < 10; i++) {
            System.out.println(helloService.hello(new Hello("1010", "测试成功，测试成功")));
        }
    }
}
